<?xml version="1.0" encoding="UTF-8"?>


<!--
	scheda.inc.xsl

	Template per formattazione scheda
-->


<xsl:stylesheet
	version = "1.0"
	xmlns = "http://www.w3.org/1999/xhtml"
	xmlns:inc = "http://ltw0807.web.cs.unibo.it/xsl/inc"
	xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">

	<!--
		Template scheda o body della scheda
	-->
	<xsl:template match = "scheda | scheda/body">
		<xsl:element name = "div">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>


	<!--
		Template scheda/metadati
	-->
	<xsl:template match = "scheda/metadati">
		<xsl:element name = "div">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:apply-templates select = "expression"/>
			<xsl:apply-templates select = "work"/>
		</xsl:element>
	</xsl:template>


	<!--
		Template scheda//expression
	-->
	<xsl:template match = "scheda//expression">
		<xsl:element name = "div">
			<xsl:call-template name = "inc:create-output-markers"/>

			<xsl:apply-templates select = "etitle"/>
			<xsl:apply-templates select = "edate"/>

			<xsl:element name = "p">
				<xsl:text>di </xsl:text>
				<xsl:apply-templates select = "ecreator"/>
			</xsl:element>

			<xsl:apply-templates select = "esubject"/>
			<xsl:apply-templates select = "etype"/>
			<xsl:apply-templates select = "erelation"/>
		</xsl:element>
	</xsl:template>


	<!--
		Template scheda//erelation
	-->
	<xsl:template match = "scheda//erelation[. != '']">
		<xsl:element name = "span">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>


	<!--
		Template scheda//etype
	-->
	<xsl:template match = "scheda//etype">
		<xsl:element name = "span">
			<xsl:value-of select = "."/>

			<xsl:choose>
				<xsl:when test = ". = 'revisione' or . = 'riassunto' or . = 'sintesi'">
					<xsl:text> di </xsl:text>
				</xsl:when>

				<xsl:when test = ". = 'dibattito'">
					<xsl:text> su </xsl:text>
				</xsl:when>

				<xsl:when test = ". = 'risposta'">
					<xsl:text> a </xsl:text>
				</xsl:when>

				<xsl:when test = ". = 'altro'">
					<xsl:text> in riferimento a </xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:element>
	</xsl:template>



	<!--
		Template scheda//etitle
	-->
	<xsl:template match = "scheda//etitle">
		<xsl:element name = "h1">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>


	<!--
		Template scheda//edate
	-->
	<xsl:template match = "scheda//edate">
		<xsl:element name = "p">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:text>Creato alle </xsl:text>
			<xsl:value-of select = "substring-after (.,'T')"/>
			<xsl:text> del </xsl:text>
			<xsl:value-of select = "substring-before (.,'T')"/>
		</xsl:element>
	</xsl:template>


	<xsl:template match = "scheda//esubject">
		<xsl:element name = "p">
			<xsl:text>Argomenti: </xsl:text>
			<xsl:apply-templates select = "folksonomia"/>
		</xsl:element>
	</xsl:template>


	<!--
		Template scheda//ecreator, scheda//wcreator o scheda//folksonomia
	-->
	<xsl:template match = "scheda//ecreator | scheda//wcreator | scheda//folksonomia">
		<xsl:element name = "span">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
		<xsl:call-template name = "inc:create-comma-and-list"/>
	</xsl:template>


	<!--
		Template scheda//work
	-->
	<xsl:template match = "scheda//work">
		<xsl:element name = "p">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:text>parte dell'opera </xsl:text>
			<xsl:apply-templates select="wtitle"/>
			<xsl:text> di </xsl:text>
			<xsl:apply-templates select="wcreator"/>
		</xsl:element>
	</xsl:template>


	<!--
		Template scheda//wtitle
	-->
	<xsl:template match = "scheda//wtitle">
		<xsl:element name = "span">
			<xsl:call-template name = "inc:create-output-markers"/>
			<xsl:call-template name = "inc:copy-js-attr"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>

</xsl:stylesheet>
